#!/srv/newsblur/venv/newsblur3/bin/python
# -*- coding: utf-8 -*-

from vendor.munin.pgbouncer import MuninPgBouncerPlugin


class MuninPgBouncerPoolsClientPlugin(MuninPgBouncerPlugin):
    command = "SHOW POOLS"
    vlabel = "Connections"
    info = "Shows number of connections to pgbouncer"

    fields = (
        ('cl_active', dict(
            label = "active",
            info = "Active connections to pgbouncer",
            type = "GAUGE",
            min = "0",
        )),
        ('cl_waiting', dict(
            label = "waiting",
            info = "Waiting connections to pgbouncer",
            type = "GAUGE",
            min = "0",
        )),
    )

    @property
    def title(self):
        return "PgBouncer client connections on %s" % self.dbwatched

if __name__ == "__main__":
    MuninPgBouncerPoolsClientPlugin().run()

